#ifndef __BOARD_CONFIG_H__
#define __BOARD_CONFIG_H__

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_TOTAL_FLOOR 5

#define FORCE_SLOW_DOWN_SIGN_MS         2000

#define DEFAULT_TOP_TRIMMING_POS        50
#define DEFAULT_TOP_TRIMMING_POS_MAX    100
#define DEFAULT_TOP_TRIMMING_POS_MIN    0

#define DEFAULT_DOWN_TRIMMING_POS       50
#define DEFAULT_DOWN_TRIMMING_POS_MAX   100
#define DEFAULT_DOWN_TRIMMING_POS_MIN   0

enum board_config_e {
    CONFIG_SPECIFIED_SPEED = 0,
    CONFIG_TOTAL_FLOOR,
    CONFIG_LEARNING_OF_FLOOR_HEIGHT,
    CONFIG_TOP_FORCE_POS,
    CONFIG_BUTTOM_FORCE_POS,
    CONFIG_TOP_FLAT_LAYER,
    CONFIG_BUTTOM_FLAT_LAYER,
    CONFIG_TOP_TRIMMING_POS,
    CONFIG_DOWN_TRIMMING_POS,
    CONFIG_COVER_ENABLE,

    CONFIG_MAX,
    CONFIG_FLAT_POS_ADDR = CONFIG_MAX * 8,
    CONFIG_UP_TRIMMING_POS_ADDR = CONFIG_FLAT_POS_ADDR + 8 * MAX_TOTAL_FLOOR,
    CONFIG_DOWN_TRIMMING_POS_ADDR = CONFIG_UP_TRIMMING_POS_ADDR + 8 * MAX_TOTAL_FLOOR,
    CONFIG_UP_SLOW_DOWN_POS_ADDR = CONFIG_DOWN_TRIMMING_POS_ADDR + 8 * MAX_TOTAL_FLOOR,
    CONFIG_DOWN_SLOW_DOWN_POS_ADDR = CONFIG_UP_SLOW_DOWN_POS_ADDR + 8 * MAX_TOTAL_FLOOR,
};

int board_config_init(void);
void board_config_write(enum board_config_e item, uint16_t value);
uint16_t board_config_adjust(enum board_config_e item, int8_t adjust);
void board_config_floor_info_write(uint16_t base_addr, uint8_t floor, uint32_t value);
uint16_t board_config_password_adjust(int8_t adjust);
void board_config_set_item_value(enum board_config_e item, uint16_t value);

#ifdef __cplusplus
}
#endif

#endif


